<template>
  <div class="layout-container">
    <!-- 顶部导航栏 -->
    <header class="layout-header" :class="{ 'header-collapsed': isCollapsed }">
      <div class="header-left">
        <!-- 折叠按钮 -->
        <el-button
          type="text"
          :icon="isCollapsed ? ElementPlusIconsVue.Fold : ElementPlusIconsVue.Menu"
          class="collapse-btn"
          @click="toggleSidebar"
        />
        <!-- 品牌Logo -->
        <div class="logo" :class="{ 'logo-collapsed': isCollapsed }">
          <span v-if="isCollapsed" class="logo-text">{{ brandName }}</span>
          <h1 v-else>{{ brandName }}</h1>
        </div>
      </div>
      
      <!-- 中间搜索框 -->
      <div class="header-center" v-if="showSearch">
        <el-input
          v-model="searchQuery"
          placeholder="搜索..."
          :prefix-icon="ElementPlusIconsVue.Search"
          size="small"
          class="header-search"
          @keyup.enter="handleSearch"
        />
      </div>
      
      <!-- 右侧用户区域 -->
      <div class="header-right">
        <!-- 通知图标 -->
        <el-button
          type="text"
          :icon="ElementPlusIconsVue.Bell"
          class="header-btn"
          @click="showNotifications = !showNotifications"
        >
          <span v-if="notificationCount > 0" class="notification-badge">{{ notificationCount }}</span>
        </el-button>
        
        <!-- 消息图标 -->
        <el-button
          type="text"
          :icon="ElementPlusIconsVue.Message"
          class="header-btn"
          @click="showMessages = !showMessages"
        >
          <span v-if="messageCount > 0" class="message-badge">{{ messageCount }}</span>
        </el-button>
        
        <!-- 主题切换 -->
        <el-button
          type="text"
          :icon="isDarkTheme ? ElementPlusIconsVue.Moon : ElementPlusIconsVue.Sunny"
          class="header-btn"
          @click="toggleTheme"
        />
        
        <!-- 语言切换 -->
        <el-select
          v-model="currentLanguage"
          placeholder="语言"
          size="small"
          class="language-select"
          @change="changeLanguage"
        >
          <el-option
            v-for="lang in languages"
            :key="lang.value"
            :label="lang.label"
            :value="lang.value"
          />
        </el-select>
        
        <!-- 用户头像 -->
        <el-dropdown
          @command="handleUserCommand"
          class="user-dropdown"
        >
          <div class="user-info" @click.stop>
            <img :src="userAvatar || defaultAvatar" alt="用户头像" class="user-avatar" />
            <span class="user-name" v-if="userName">{{ userName }}</span>
            <el-icon class="user-arrow"><ElementPlusIconsVue.ArrowDown /></el-icon>
          </div>
          <template #dropdown>
            <el-dropdown-menu>
              <el-dropdown-item command="profile">个人资料</el-dropdown-item>
              <el-dropdown-item command="settings">系统设置</el-dropdown-item>
              <el-dropdown-item command="help">帮助中心</el-dropdown-item>
              <el-dropdown-item command="logout" divided>退出登录</el-dropdown-item>
            </el-dropdown-menu>
          </template>
        </el-dropdown>
      </div>
      
      <!-- 通知面板 -->
      <div v-if="showNotifications" class="notification-panel" ref="notificationPanel" @click.stop>
        <div class="panel-header">
          <h3>通知中心</h3>
          <el-button type="text" size="small" @click="showNotifications = false">关闭</el-button>
        </div>
        <div class="panel-content">
          <div v-if="notifications.length > 0" class="notification-list">
            <div
              v-for="notification in notifications"
              :key="notification.id"
              class="notification-item"
              :class="{ 'unread': !notification.read }"
              @click="markAsRead(notification.id)"
            >
              <div class="notification-icon">
                <el-icon :class="notification.type"><Bell /></el-icon>
              </div>
              <div class="notification-content">
                <div class="notification-title">{{ notification.title }}</div>
                <div class="notification-message">{{ notification.message }}</div>
                <div class="notification-time">{{ formatTime(notification.time) }}</div>
              </div>
            </div>
          </div>
          <div v-else class="empty-notifications">
            <el-empty description="暂无通知" />
          </div>
        </div>
      </div>
    </header>
    
    <!-- 主内容区域 -->
    <div class="layout-main">
      <!-- 侧边栏 -->
      <aside class="layout-sidebar" :class="{ 'sidebar-collapsed': isCollapsed }">
        <!-- 侧边栏菜单 -->
        <el-menu
          :default-active="activeRoute"
          class="sidebar-menu"
          @select="handleMenuSelect"
          router
          :collapse-transition="false"
          :collapse="isCollapsed"
        >
          <!-- 菜单项组 -->
          <template v-for="group in menuGroups" :key="group.title">
            <el-sub-menu v-if="group.children && group.children.length > 0" :index="group.key">
              <template #title>
                <el-icon><component :is="group.icon" /></el-icon>
                <span>{{ group.title }}</span>
              </template>
              <el-menu-item
                v-for="item in group.children"
                :key="item.key"
                :index="item.path || item.key"
                :disabled="item.disabled"
                @click="handleMenuItemClick(item)"
              >
                <el-icon v-if="item.icon"><component :is="item.icon" /></el-icon>
                <span>{{ item.title }}</span>
              </el-menu-item>
            </el-sub-menu>
            <el-menu-item
              v-else
              :key="group.key"
              :index="group.path || group.key"
              :disabled="group.disabled"
              @click="handleMenuItemClick(group)"
            >
              <el-icon><component :is="group.icon" /></el-icon>
              <span>{{ group.title }}</span>
            </el-menu-item>
          </template>
        </el-menu>
        
        <!-- 侧边栏底部 -->
        <div class="sidebar-footer" :class="{ 'footer-collapsed': isCollapsed }">
          <div v-if="!isCollapsed" class="sidebar-info">
            <div class="info-item">
              <span class="info-label">在线时长</span>
              <span class="info-value">{{ onlineTime }}</span>
            </div>
            <div class="info-item">
              <span class="info-label">登录IP</span>
              <span class="info-value">{{ loginIp }}</span>
            </div>
          </div>
        </div>
      </aside>
      
      <!-- 内容区域 -->
      <main class="layout-content" :class="{ 'content-expanded': isCollapsed }">
        <!-- 面包屑导航 -->
        <div class="breadcrumb-container" v-if="showBreadcrumb">
          <el-breadcrumb separator="/">
            <el-breadcrumb-item
              v-for="(crumb, index) in breadcrumbs"
              :key="index"
              :to="crumb.path"
            >
              {{ crumb.name }}
            </el-breadcrumb-item>
          </el-breadcrumb>
        </div>
        
        <!-- 页面标题 -->
        <div class="page-header" v-if="showPageHeader">
          <h2>{{ pageTitle }}</h2>
          <div class="header-actions">
            <slot name="header-actions"></slot>
          </div>
        </div>
        
        <!-- 主要内容 -->
        <div class="main-content">
          <slot></slot>
        </div>
        
        <!-- 页脚 -->
        <footer class="page-footer" v-if="showFooter">
          <div class="footer-content">
            <span class="copyright">{{ copyright }}</span>
            <span class="version">版本 {{ appVersion }}</span>
          </div>
        </footer>
      </main>
    </div>
  </div>
</template>

<script setup>
import { ref, computed, onMounted, onUnmounted, watch, nextTick, getCurrentInstance } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { storeToRefs } from 'pinia'
import useAppStore from '@/store/modules/app'
import useUserStore from '@/store/modules/user'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import { House, Box, Document, List, User, Setting } from '@element-plus/icons-vue'

// 获取当前组件实例
const instance = getCurrentInstance()

// 获取路由和用户状态
const router = useRouter()
const route = useRoute()
const appStore = useAppStore()
const userStore = useUserStore()
// 正确解构appStore中的状态，避免直接访问不存在的属性
const {
  sidebar: storeSidebar,
  theme: storeTheme,
  language: storeLanguage
} = storeToRefs(appStore)
const { userInfo, permissions } = storeToRefs(userStore)

// 将图标名称转换为正确的组件格式
const getIconComponent = (iconName) => {
  if (typeof iconName === 'string') {
    const iconComponent = ElementPlusIconsVue[iconName]
    console.log(`Icon: ${iconName}, Component:`, iconComponent)
    return iconComponent
  }
  console.log(`Non-string icon:`, iconName)
  return iconName
}

// 定义组件的props
const props = defineProps({
  // 品牌名称
  brandName: {
    type: String,
    default: '测试平台'
  },
  // 显示搜索框
  showSearch: {
    type: Boolean,
    default: false
  },
  // 显示面包屑
  showBreadcrumb: {
    type: Boolean,
    default: true
  },
  // 显示页面标题
  showPageHeader: {
    type: Boolean,
    default: true
  },
  // 显示页脚
  showFooter: {
    type: Boolean,
    default: true
  },
  // 页脚版权信息
  copyright: {
    type: String,
    default: '© 2024 测试平台 版权所有'
  },
  // 应用版本
  appVersion: {
    type: String,
    default: '1.0.0'
  },
  // 语言选项
  languages: {
    type: Array,
    default: () => [
      { value: 'zh-CN', label: '中文' },
      { value: 'en-US', label: 'English' }
    ]
  },
  // 默认头像
  defaultAvatar: {
    type: String,
    default: 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png'
  },
  // 在线时长
  onlineTime: {
    type: String,
    default: '00:00:00'
  },
  // 登录IP
  loginIp: {
    type: String,
    default: '127.0.0.1'
  }
})

// 组件状态
const searchQuery = ref('')
const showNotifications = ref(false)
const showMessages = ref(false)
const notifications = ref([])
const notificationCount = ref(0)
const messageCount = ref(0)
const notificationPanel = ref(null)

// 计算属性 - 侧边栏折叠状态
const isCollapsed = computed({
  get: () => !(storeSidebar?.value?.opened),
  set: (value) => {
    if (!value) {
      appStore.openSidebar()
    } else {
      appStore.closeSidebar()
    }
  }
})

// 计算属性 - 主题状态
const isDarkTheme = computed({
  get: () => storeTheme?.value === 'dark',
  set: (value) => appStore.setTheme(value ? 'dark' : 'light')
})

// 计算属性 - 当前语言
const currentLanguage = computed({
  get: () => storeLanguage?.value || 'zh-CN',
  set: (value) => appStore.setLanguage(value)
})

// 计算属性 - 当前激活的路由
const activeRoute = computed(() => {
  // 对于测试单管理路径，返回测试单管理菜单项的path值
  if (route.path === '/dashboard/test-order/manage') {
    return '/dashboard'
  } 
  return route.path || 'home'
})

// 计算属性 - 页面标题
const pageTitle = computed(() => {
  return route.meta.title || '首页'
})

// 计算属性 - 面包屑
const breadcrumbs = computed(() => {
  return route.meta.breadcrumbs || [{ name: '首页', path: '/' }]
})

// 计算属性 - 用户头像
const userAvatar = computed(() => {
  return userInfo.value?.avatar || ''
})

// 计算属性 - 用户姓名
const userName = computed(() => {
  return userInfo.value?.name || userInfo.value?.username || '用户'
})

// 计算属性 - 菜单组
const menuGroups = computed(() => {
  // 这里可以根据用户权限动态生成菜单
  // 实际项目中应该从后端获取或根据用户权限过滤
  return [
    {
      key: 'home',
      title: '首页',
      path: '/',
      icon: House
    },
    {      key: 'product',      title: '产品管理',      icon: Box,      children: [        {
          key: 'product-list',
          title: '产品清单管理',
          path: '/dashboard/product/list'
        },        {
          key: 'product-member',
          title: '产品人员管理',
          path: '/dashboard/product/members'
        },        {
          key: 'product-requirement',
          title: '产品需求管理',
          path: '/dashboard/product/requirements'
        },        {
          key: 'product-version',
          title: '测试版本管理',
          path: '/dashboard/product/test-versions'
        }      ]    },
    {      key: 'testcase',      title: '测试用例管理',      icon: List,      children: [
        {
          key: 'testcase-list',
          title: '用例清单列表',
          path: '/dashboard/testcase/list'
        },
        {
          key: 'manual-testcase',
          title: '手动测试用例',
          path: '/dashboard/testcase/list?type=manual'
        },
        {
          key: 'auto-ui-testcase',
          title: 'UI自动化测试用例',
          path: '/dashboard/testcase/list?type=auto-ui'
        },
        {
          key: 'interface-testcase',
          title: '接口测试用例',
          path: '/dashboard/testcase/list?type=interface'
        },
        {
          key: 'performance-testcase',
          title: '性能测试用例',
          path: '/dashboard/testcase/list?type=performance'
        }
      ]    },    {      key: 'pre-integration-test',      title: '预集成测试申请',      icon: Document,      children: [        {          key: 'test-application-create',          title: '发起申请',          path: '/dashboard/application/create'        },        {          key: 'test-application-list',          title: '申请列表',          path: '/dashboard/application/list'        },        {          key: 'approval-todo',          title: '审批待办',          path: '/dashboard/application/approval'        }      ]    },
    // 测试单管理作为首页的子功能，通过组件内切换实现子页面操作
    {      key: 'test-order',      title: '测试单管理',      icon: List,      path: '/dashboard',
      // 当activeRoute为/dashboard/testOrder时，也能匹配到这个菜单项
      matchRoutes: ['/dashboard/testOrder']    },
    {
      key: 'user',
      title: '用户管理',
      icon: User,
      children: [
        {
          key: 'user-list',
          title: '用户列表',
          path: '/user/list'
        },
        {
          key: 'role-list',
          title: '角色管理',
          path: '/user/role'
        }
      ]
    },
    {      key: 'system',      title: '系统设置',      icon: Setting,      children: [        {          key: 'system-users',          title: '用户管理',          path: '/dashboard/system/users'        },        {          key: 'system-roles',          title: '角色管理',          path: '/dashboard/system/roles'        },        {          key: 'system-menus',          title: '菜单管理',          path: '/dashboard/system/menus'        }      ]    }
  ]
})

// 切换侧边栏
function toggleSidebar() {
  isCollapsed.value = !isCollapsed.value
}

// 切换主题
function toggleTheme() {
  isDarkTheme.value = !isDarkTheme.value
  // 实际项目中应该有更复杂的主题切换逻辑
}

// 切换语言
function changeLanguage(lang) {
  currentLanguage.value = lang
  // 实际项目中应该有更复杂的语言切换逻辑
}

// 处理搜索
function handleSearch() {
  // 处理搜索逻辑
  console.log('搜索:', searchQuery.value)
}

// 处理菜单项选择
function handleMenuSelect(key, keyPath) {
  console.log('选择菜单:', key, keyPath)
  // 这里可以添加菜单项选择的逻辑
}

// 处理菜单项点击
function handleMenuItemClick(item) {
  console.log('点击菜单项:', item)
  // 对于测试单管理，添加view=testOrder参数来触发Dashboard中的视图切换
  if (item.key === 'test-order' && item.path === '/dashboard') {
    router.push({ path: '/dashboard', query: { view: 'testOrder' } })
  }
}

// 处理用户命令
function handleUserCommand(command) {
  switch (command) {
    case 'profile':
      router.push('/user/profile')
      break
    case 'settings':
      router.push('/user/settings')
      break
    case 'help':
      router.push('/help')
      break
    case 'logout':
      handleLogout()
      break
    default:
      break
  }
}

// 处理退出登录
function handleLogout() {
  // 显示确认对话框
  ElMessageBox.confirm('确定要退出登录吗？', '提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning'
  }).then(() => {
    // 调用用户状态管理的登出方法
    userStore.logout()
    // 跳转到登录页
    router.push('/login')
  }).catch(() => {
    // 取消退出
  })
}

// 标记通知为已读
function markAsRead(notificationId) {
  const notification = notifications.value.find(n => n.id === notificationId)
  if (notification && !notification.read) {
    notification.read = true
    notificationCount.value = notifications.value.filter(n => !n.read).length
  }
}

// 格式化时间
function formatTime(time) {
  if (!time) return ''
  // 这里应该有更复杂的时间格式化逻辑
  return new Date(time).toLocaleString()
}

// 处理点击外部关闭通知面板
function handleClickOutside(event) {
  if (notificationPanel.value && !notificationPanel.value.contains(event.target)) {
    showNotifications.value = false
  }
}

// 监听路由变化
watch(route, (newRoute) => {
  // 路由变化时可以做一些处理
  console.log('路由变化:', newRoute)
}, { immediate: true })

// 组件挂载
onMounted(() => {
  // 初始化通知数据
  // 实际项目中应该从后端获取
  notifications.value = [
    {
      id: 1,
      title: '系统通知',
      message: '系统将在今晚22:00-23:00进行维护，请提前做好准备',
      time: new Date().getTime() - 3600000,
      read: false,
      type: 'warning'
    },
    {
      id: 2,
      title: '申请审批',
      message: '您的测试申请已通过审批，可以开始执行测试任务',
      time: new Date().getTime() - 7200000,
      read: false,
      type: 'success'
    },
    {
      id: 3,
      title: '测试完成',
      message: '您负责的产品测试任务已完成，请查看测试报告',
      time: new Date().getTime() - 10800000,
      read: true,
      type: 'info'
    }
  ]
  
  // 计算未读通知数量
  notificationCount.value = notifications.value.filter(n => !n.read).length
  
  // 添加点击外部关闭通知面板的事件监听
  document.addEventListener('click', handleClickOutside)
})

// 组件卸载
onUnmounted(() => {
  // 移除事件监听
  document.removeEventListener('click', handleClickOutside)
})
</script>

<style scoped>
/* 布局容器 */
.layout-container {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #f5f7fa;
  overflow: hidden;
}

/* 顶部导航栏 */
.layout-header {
  height: 60px;
  background-color: #fff;
  border-bottom: 1px solid #e4e7ed;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transition: all 0.3s ease;
}

.header-collapsed {
  padding-left: 60px;
}

.header-left {
  display: flex;
  align-items: center;
}

.collapse-btn {
  margin-right: 10px;
  font-size: 16px;
  color: #606266;
}

.logo {
  display: flex;
  align-items: center;
  margin-right: 20px;
  transition: all 0.3s ease;
}

.logo img {
  width: 32px;
  height: 32px;
  margin-right: 10px;
}

.logo h1 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: #1890ff;
}

.logo-collapsed {
  margin-right: 0;
}

.logo-text {
  display: inline-block;
  width: 20px;
  height: 20px;
  background-color: #1890ff;
  border-radius: 4px;
}

.header-center {
  flex: 1;
  max-width: 400px;
  margin: 0 20px;
}

.header-search {
  width: 100%;
}

.header-right {
  display: flex;
  align-items: center;
}

.header-btn {
  margin: 0 5px;
  color: #606266;
  position: relative;
}

.notification-badge,
.message-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 14px;
  height: 14px;
  padding: 0 4px;
  line-height: 14px;
  font-size: 10px;
  color: #fff;
  background-color: #f56c6c;
  border-radius: 7px;
  text-align: center;
}

.language-select {
  margin: 0 10px;
  width: 80px;
}

.user-dropdown {
  margin-left: 10px;
}

.user-info {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0 5px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin-right: 5px;
}

.user-name {
  margin-right: 5px;
  color: #606266;
}

.user-arrow {
  font-size: 12px;
  color: #606266;
}

/* 通知面板 */
.notification-panel {
  position: fixed;
  top: 60px;
  right: 20px;
  width: 360px;
  max-height: 480px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 2000;
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #e4e7ed;
  background-color: #fafafa;
}

.panel-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.panel-content {
  max-height: 420px;
  overflow-y: auto;
}

.notification-list {
  padding: 8px 0;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.notification-item:hover {
  background-color: #f5f7fa;
}

.notification-item.unread {
  background-color: #f0f9ff;
}

.notification-icon {
  margin-right: 12px;
  font-size: 16px;
}

.notification-icon.success {
  color: #67c23a;
}

.notification-icon.warning {
  color: #e6a23c;
}

.notification-icon.error {
  color: #f56c6c;
}

.notification-icon.info {
  color: #909399;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-title {
  font-size: 13px;
  font-weight: 500;
  color: #303133;
  margin-bottom: 4px;
}

.notification-message {
  font-size: 12px;
  color: #606266;
  margin-bottom: 4px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  display: box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  box-orient: vertical;
  max-height: calc(1.4em * 2); /* 两行文字的最大高度 */
}

.notification-time {
  font-size: 11px;
  color: #909399;
}

.empty-notifications {
  padding: 40px 20px;
  text-align: center;
}

/* 主内容区域 */
.layout-main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* 侧边栏 */
.layout-sidebar {
  width: 220px;
  background-color: #fff;
  border-right: 1px solid #e4e7ed;
  overflow-y: auto;
  transition: all 0.3s ease;
  z-index: 900;
}

.sidebar-collapsed {
  width: 60px;
}

.sidebar-menu {
  border-right: none;
}

/* 一级菜单样式 - 更突出显示 */
.sidebar-menu .el-sub-menu {
  font-weight: 700;
  margin-bottom: 4px;
}

.sidebar-menu .el-sub-menu__title {
  padding-left: 20px !important;
  padding-top: 12px !important;
  padding-bottom: 12px !important;
  font-size: 15px;
  color: #2c3e50;
  background-color: #ecf5ff;
  border-left: 4px solid #409EFF;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.sidebar-menu .el-sub-menu__title:hover {
  background-color: #d9ecff !important;
  color: #409EFF !important;
}

.sidebar-menu .el-sub-menu__title.is-active {
  background-color: #409EFF !important;
  color: white !important;
  border-left-color: #267dcc;
}

/* 二级菜单样式 - 更柔和，并有缩进 */
.sidebar-menu .el-menu-item {
  padding-left: 60px !important;
  padding-top: 10px !important;
  padding-bottom: 10px !important;
  font-size: 12px;
  color: #606266;
  font-weight: normal;
  transition: all 0.3s ease;
  border-left: 2px solid transparent;
}

.sidebar-menu .el-menu-item:hover {
  background-color: #f0f9ff !important;
  padding-left: 65px !important;
  color: #409EFF !important;
  border-left-color: #409EFF;
}

.sidebar-menu .el-menu-item.is-active {
  background-color: #f0f9ff !important;
  color: #409EFF !important;
  font-weight: 600;
  border-left-color: #409EFF;
}

/* 侧边栏折叠状态下的菜单样式 */
.sidebar-collapsed .sidebar-menu .el-sub-menu__title {
  padding-left: 15px !important;
  border-left: none;
}

.sidebar-collapsed .sidebar-menu .el-menu-item {
  padding-left: 15px !important;
}

.sidebar-collapsed .sidebar-menu .el-menu-item:hover {
  padding-left: 20px !important;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #e4e7ed;
  background-color: #fafafa;
}

.footer-collapsed {
  padding: 8px;
}

.sidebar-info {
  font-size: 12px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.info-item:last-child {
  margin-bottom: 0;
}

.info-label {
  color: #909399;
}

.info-value {
  color: #606266;
  font-weight: 500;
}

/* 内容区域 */
.layout-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  transition: all 0.3s ease;
}

.content-expanded {
  padding-left: 30px;
}

/* 面包屑 */
.breadcrumb-container {
  margin-bottom: 16px;
}

/* 页面标题 */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e4e7ed;
}

.page-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #303133;
}

.header-actions {
  display: flex;
  gap: 8px;
}

/* 主要内容 */
.main-content {
  background-color: #fff;
  border-radius: 8px;
  padding: 20px;
  min-height: calc(100vh - 220px);
}

/* 页脚 */
.page-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e4e7ed;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #909399;
}

/* 响应式调整 */
@media screen and (max-width: 768px) {
  .layout-header {
    padding: 0 10px;
  }
  
  .header-center {
    display: none;
  }
  
  .layout-sidebar {
    position: fixed;
    left: -220px;
    top: 60px;
    height: calc(100vh - 60px);
    z-index: 1100;
  }
  
  .layout-sidebar.sidebar-expanded {
    left: 0;
  }
  
  .layout-content {
    padding: 10px;
  }
  
  .notification-panel {
    width: 100%;
    right: 0;
    border-radius: 0;
  }
}

@media screen and (max-width: 480px) {
  .header-right .header-btn:not(:last-child) {
    display: none;
  }
  
  .main-content {
    padding: 10px;
  }
  
  .page-footer {
    text-align: center;
  }
  
  .footer-content {
    flex-direction: column;
    gap: 8px;
  }
}
</style>